import request from '@/router/axios';
import { baseUrl } from '@/config/env';

/* 获取列表 */
export const getAppList = (param) => request({
    url: baseUrl + '/app/function',
    method: 'get',
    params: param
});
// 根据类型获取手机端功能菜单 tree
export const getAppTree = (itemCode) => request({
    url: baseUrl + '/data-items/' + itemCode + '/tree',
    method: 'get'
});
/* 新增 */
export const addAppFunc = (obj) => request({
    url: baseUrl + '/app/function',
    method: 'post',
    data: obj
});

/* 修改 */
export const updateAppFunc = (id, obj) => request({
    url: baseUrl + '/app/function/' + id,
    method: 'put',
    data: obj
});

/* 删除 */
export const appDelete = (ids) => request({
    url: baseUrl + '/app/function/' + ids,
    method: 'delete'
});

/* 显隐开关 */
export const appEnable = (id, isShow) => request({
    url: baseUrl + '/app/function/' + id + '/set-show/' + isShow,
    method: 'patch'
})